home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
c
/
cppmatrx.zip
/
MATRIX.ZIP
/
MATRIX2.BAK
< prev
next >
Wrap
Text File
|
1991-01-27
|
1KB
|
74 lines
#include <iostream.h>
typedef double m_line [4];
typedef m_line *m_type;
class matrix {
m_type m;
public:
matrix (void);
~matrix (void);
void print_matrix (void);
friend matrix operator+(matrix&, matrix&);
};
matrix operator+(matrix& arg1, matrix& arg2)
{
matrix sum;
int i,j;
for (i=0; i<4; i++)
for (j=0; j<4; j++)
;
// sum.m [i][j] = arg1.m [i][j] + arg2.m [i][j];
return sum;
}
void matrix::print_matrix (void)
{
int i,j;
for (i = 0; i < 4; i++) {
for (j = 0; j < 4; j++)
cout << m [i][j];
cout << '\n';
}
}
matrix::matrix (void)
{
int i,j;
m = new m_line [4];
for (i = 0; i < 4; i++)
for (j = 0; j < 4; j++)
m [i][j] = 1;
}
matrix::~matrix (void)
{
delete m [4];
}
void main (void)
{
matrix matrix_test_1;
matrix matrix_test_2;
(matrix_test_1+matrix_test_2).print_matrix ();
}